package com.feifan.oa.service.impl;

import com.feifan.common.core.text.Convert;
import com.feifan.oa.domain.Attendance;
import com.feifan.oa.mapper.AttendanceMapper;
import com.feifan.oa.service.IAttendanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 员工考勤Service业务层处理
 *
 * @author 非凡
 * @date 2020-09-19
 */
@Service
public class AttendanceServiceImpl implements IAttendanceService
{
    @Autowired
    private AttendanceMapper attendanceMapper;

    /**
     * 查询员工考勤
     *
     * @param id 员工考勤ID
     * @return 员工考勤
     */
    @Override
    public Attendance selectAttendanceById(Long id)
    {
        return attendanceMapper.selectAttendanceById(id);
    }

    /**
     * 查询员工考勤列表
     *
     * @param attendance 员工考勤
     * @return 员工考勤
     */
    @Override
    public List<Attendance> selectAttendanceList(Attendance attendance)
    {
        return attendanceMapper.selectAttendanceList(attendance);
    }

    /**
     * 新增员工考勤
     *
     * @param attendance 员工考勤
     * @return 结果
     */
    @Override
    public int insertAttendance(Attendance attendance)
    {
        return attendanceMapper.insertAttendance(attendance);
    }

    /**
     * 修改员工考勤
     *
     * @param attendance 员工考勤
     * @return 结果
     */
    @Override
    public int updateAttendance(Attendance attendance)
    {
        return attendanceMapper.updateAttendance(attendance);
    }

    /**
     * 删除员工考勤对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteAttendanceByIds(String ids)
    {
        return attendanceMapper.deleteAttendanceByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除员工考勤信息
     *
     * @param id 员工考勤ID
     * @return 结果
     */
    @Override
    public int deleteAttendanceById(Long id)
    {
        return attendanceMapper.deleteAttendanceById(id);
    }

    @Override
    public Attendance selectAttendanceByTime(Long userId, Integer type) {
        return attendanceMapper.selectAttendanceByTime(userId,type);
    }
}